home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / 3DTOSHI2.ZIP / mpgfx / include / gfxdpmi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-23  |  3.9 KB  |  203 lines

  1.  
  2. // gfxdpmi.h
  3. //
  4. // Copyright (c) 1995 by Toshiaki Tsuji, all rights reserved.
  5.  
  6. #ifndef __GFXDPMI_H__
  7. #define __GFXDPMI_H__
  8.  
  9. #include "stdgfx.h"
  10. #include "gfxsys.h"
  11.  
  12. struct RMREGS
  13.   {
  14.     DWORD EDI;
  15.     DWORD ESI;
  16.     DWORD EBP;
  17.     DWORD Reserved;
  18.     DWORD EBX;
  19.     DWORD EDX;
  20.     DWORD ECX;
  21.     DWORD EAX;
  22.     WORD  Flags;
  23.     WORD  ES;
  24.     WORD  DS;
  25.     WORD  FS;
  26.     WORD  GS;
  27.     WORD  IP;
  28.     WORD  CS;
  29.     WORD  SP;
  30.     WORD  SS;
  31.   }; // End of RMREGS
  32.  
  33. #if defined (__FORWIN32__)
  34.   #if defined (__FORBORLAND__)
  35.      struct BYTEREGS
  36.        {
  37.          BYTE al,ah,bl,bh;
  38.          BYTE cl,ch,dl,dh;
  39.        };
  40.  
  41.      struct WORDREGS
  42.        {
  43.          USHORT ax,bx,cx,dx;
  44.          USHORT si,di,cflag,flags;
  45.        };
  46.  
  47.      union REGS
  48.        {
  49.          struct WORDREGS x;
  50.          struct BYTEREGS h;
  51.        };
  52.  
  53.      struct SREGS
  54.        {
  55.          USHORT es;
  56.          USHORT ss;
  57.          USHORT cs;
  58.          USHORT ds;
  59.        };
  60.   #endif
  61. #if defined (__FORVISUAL__)
  62.      struct BYTEREGS
  63.        {
  64.          BYTE al,ah,bl,bh;
  65.          BYTE cl,ch,dl,dh;
  66.        };
  67.  
  68.      struct WORDREGS
  69.        {
  70.          USHORT ax,bx,cx,dx;
  71.          USHORT si,di,cflag,flags;
  72.        };
  73.  
  74.      union REGS
  75.        {
  76.          struct WORDREGS x;
  77.          struct BYTEREGS h;
  78.        };
  79.  
  80.      struct SREGS
  81.        {
  82.          USHORT es;
  83.          USHORT ss;
  84.          USHORT cs;
  85.          USHORT ds;
  86.        };
  87.   #endif
  88. #elif defined (__FORWIN32S__)
  89.   #if defined (__FORBORLAND__)
  90.      struct BYTEREGS
  91.        {
  92.          BYTE al,ah,bl,bh;
  93.          BYTE cl,ch,dl,dh;
  94.        };
  95.  
  96.      struct WORDREGS
  97.        {
  98.          USHORT ax,bx,cx,dx;
  99.          USHORT si,di,cflag,flags;
  100.        };
  101.  
  102.      union REGS
  103.        {
  104.          struct WORDREGS x;
  105.          struct BYTEREGS h;
  106.        };
  107.  
  108.      struct SREGS
  109.        {
  110.          USHORT es;
  111.          USHORT ss;
  112.          USHORT cs;
  113.          USHORT ds;
  114.        };
  115.   #endif
  116. #if defined (__FORVISUAL__)
  117.      struct BYTEREGS
  118.        {
  119.          BYTE al,ah,bl,bh;
  120.          BYTE cl,ch,dl,dh;
  121.        };
  122.  
  123.      struct WORDREGS
  124.        {
  125.          USHORT ax,bx,cx,dx;
  126.          USHORT si,di,cflag,flags;
  127.        };
  128.  
  129.      union REGS
  130.        {
  131.          struct WORDREGS x;
  132.          struct BYTEREGS h;
  133.        };
  134.  
  135.      struct SREGS
  136.        {
  137.          USHORT es;
  138.          USHORT ss;
  139.          USHORT cs;
  140.          USHORT ds;
  141.        };
  142.   #endif
  143. #elif defined (__FORUNIX__)
  144.   struct BYTEREGS
  145.     {
  146.       BYTE al,ah,bl,bh;
  147.       BYTE cl,ch,dl,dh;
  148.     };
  149.  
  150.   struct WORDREGS
  151.     {
  152.       USHORT ax,bx,cx,dx;
  153.       USHORT si,di,cflag,flags;
  154.     };
  155.  
  156.   union REGS
  157.     {
  158.       struct WORDREGS x;
  159.       struct BYTEREGS h;
  160.     };
  161.  
  162.   struct SREGS
  163.     {
  164.       USHORT es;
  165.       USHORT ss;
  166.       USHORT cs;
  167.       USHORT ds;
  168.     };
  169. #endif
  170.  
  171. class DPMITOOL : public SYSTEMTOOL
  172.   {
  173.     protected :
  174.       union  REGS  Regs;
  175.       struct SREGS SegRegs;
  176.       RMREGS  *RmRegs;
  177.  
  178.       void InitRmRegs ();
  179.       void SetRmRegs ( union REGS *InRegs );
  180.       void SetRmRegs ( union REGS *InRegs, struct SREGS *SRegs );
  181.       void GetRmRegs ( union REGS *OutRegs, struct SREGS *SRegs );
  182.       void GetRmRegs ( union REGS *OutRegs );
  183.  
  184.     public :
  185.       DPMITOOL ();
  186.       virtual ~DPMITOOL ();
  187.  
  188.       void  AllocateDOSMemory ( INT NumPara, WORD* Selector, WORD* Segment );
  189.       void  FreeDOSMemory ( WORD Selector );
  190.       void  Int86 ( INT IntNo, union REGS *InRegs, union REGS *OutRegs );
  191.       void  Int86x ( INT IntNo, union REGS *InRegs, union REGS *OutRegs, struct SREGS* SRegs );
  192.       void* MapRealToLinear ( DWORD Pointer );
  193.       WORD  AllocateSelector ( INT NumSelector );
  194.       void  FreeSelector ( WORD Selector );
  195.       BOOLEAN SetSelectorAddress ( WORD Selector, DWORD Address );
  196.       BOOLEAN SetSelectorLimit ( WORD Selector, DWORD Limit ); 
  197.   }; // End of DPMITOOL
  198.  
  199. extern DPMITOOL DPMI;
  200.  
  201. #endif
  202.  
  203.